﻿je_french_revolution_election = {

	icon = "gfx/interface/icons/event_icons/event_election.dds"

	immediate = {
		ruler = {
			save_scope_as = ruler_scope
		}
		random_scope_character = {
			limit = {has_variable = napoleon3}
			save_scope_as = napoleon3_scope
		}
		random_scope_character = {
			limit = {has_variable = cavaignac}
			save_scope_as = cavaignac_scope
		}
		random_scope_character = {
			limit = {has_variable = agrarian_leader}
			save_scope_as = agrarian_leader_scope
		}
		random_scope_character = {
			limit = {has_variable = radical_leader}
			save_scope_as = radical_leader_scope
		}
		trigger_event = { id = france_event.4 days = 150}
		trigger_event = { id = france_event.5 days = 90}
	}

	complete = {
		custom_tooltip = {
			text = je_french_revolution_election_complete
			OR = {
				has_variable = napoleon3_elected
				has_variable = cavaignac_elected
				has_variable = agrarian_leader_elected
				has_variable = radical_leader_elected
			}
		}
    }

    fail = {
	    OR ={
			custom_tooltip = {
				text = je_french_revolution_election_fail.1
	    		OR = {
	    			has_law = law_type:law_monarchy
	    			has_law = law_type:law_theocracy
	    		}
	    	}
			custom_tooltip = {
				text = je_french_revolution_election_fail.2
	    		OR = {
					has_law = law_type:law_autocracy
					has_law = law_type:law_oligarchy
					has_law = law_type:law_landed_voting
					has_law = law_type:law_anarchy
	    		}
	    	}
			custom_tooltip = {
				text = je_french_revolution_election_fail.3
				has_variable = fail_french_elections
	    	}
	    }
    }

	status_desc = {
		first_valid = {
			triggered_desc = {
				desc = je_french_revolution_election_goal.4
				trigger = {
					NOT = {
						exists = py:conservative_party
					}
					exists = py:liberal_party
					exists = py:agrarian_party	
				}
			}
			triggered_desc = {
				desc = je_french_revolution_election_goal.5
				trigger = {
					NOT = {
						exists = py:conservative_party
					}
					exists = py:liberal_party
					exists = py:radical_party	
				}
			}
			triggered_desc = {
				desc = je_french_revolution_election_goal.1
				trigger = {
					exists = py:conservative_party
					exists = py:liberal_party
					exists = py:agrarian_party	
				}
			}
			triggered_desc = {
				desc = je_french_revolution_election_goal.2
				trigger = {
					exists = py:conservative_party
					exists = py:liberal_party
					exists = py:radical_party	
				}
			}
			triggered_desc = {
				desc = je_french_revolution_election_goal.3
				trigger = {
					exists = py:conservative_party
					exists = py:radical_party	
				}
			}
		}
	}

	weight = 1

	should_be_pinned_by_default = yes
}